import { Spin } from "antd";
import cs from "classnames";
import styles from "./index.module.less";

interface Props {
	rootClass?: any;
	isHeight100?: boolean;
	text?: string;
	loading?: boolean;
	children?: any;
}

export default (props: Props) => {
	const { rootClass, isHeight100, text, loading } = props;

	return (
		<Spin
			size={"large"}
			wrapperClassName={cs({
				[rootClass]: Boolean(rootClass),
				[styles.height100]: isHeight100
			})}
			spinning={loading}
			tip={text}
		>
			{props.children}
		</Spin>
	);
};
